﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class Bag&lt;T&gt;
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class Bag&lt;T&gt;
   ">
    <meta name="generator" content="docfx 2.56.4.0">
    
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">
    
    
    
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="../index.html">
                <img id="logo" class="svg" src="../logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div role="main" class="container body-content hide-when-search">
        
        <div class="sidenav hide-when-search">
          <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
          <div class="sidetoggle collapse" id="sidetoggle">
            <div id="sidetoc"></div>
          </div>
        </div>
        <div class="article row grid-right">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="Wintellect.PowerCollections.Bag`1">
  
  
  <h1 id="Wintellect_PowerCollections_Bag_1" data-uid="Wintellect.PowerCollections.Bag`1" class="text-break">Class Bag&lt;T&gt;
  </h1>
  <div class="markdown level0 summary"><p>Bag&lt;T&gt; is a collection that contains items of type T.
Unlike a Set, duplicate items (items that compare equal to each other) are allowed in an Bag.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><span class="xref">System.Object</span></div>
    <div class="level1"><a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html">CollectionBase</a>&lt;T&gt;</div>
    <div class="level2"><span class="xref">Bag&lt;T&gt;</span></div>
  </div>
  <div classs="implements">
    <h5>Implements</h5>
    <div><span class="xref">System.Collections.Generic.ICollection</span>&lt;T&gt;</div>
    <div><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</div>
    <div><span class="xref">System.Collections.ICollection</span></div>
    <div><span class="xref">System.Collections.IEnumerable</span></div>
    <div><span class="xref">System.ICloneable</span></div>
  </div>
  <div class="inheritedMembers">
    <h5>Inherited Members</h5>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_ToString">CollectionBase&lt;T&gt;.ToString()</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_CopyTo__0___System_Int32_">CollectionBase&lt;T&gt;.CopyTo(T[], Int32)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_ToArray">CollectionBase&lt;T&gt;.ToArray()</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_System_Collections_Generic_ICollection_T__IsReadOnly">CollectionBase&lt;T&gt;.ICollection&lt;T&gt;.IsReadOnly</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_AsReadOnly">CollectionBase&lt;T&gt;.AsReadOnly()</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_Exists_System_Predicate__0__">CollectionBase&lt;T&gt;.Exists(Predicate&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_TrueForAll_System_Predicate__0__">CollectionBase&lt;T&gt;.TrueForAll(Predicate&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_CountWhere_System_Predicate__0__">CollectionBase&lt;T&gt;.CountWhere(Predicate&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_FindAll_System_Predicate__0__">CollectionBase&lt;T&gt;.FindAll(Predicate&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_RemoveAll_System_Predicate__0__">CollectionBase&lt;T&gt;.RemoveAll(Predicate&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_ForEach_System_Action__0__">CollectionBase&lt;T&gt;.ForEach(Action&lt;T&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_ConvertAll__1_System_Converter__0___0__">CollectionBase&lt;T&gt;.ConvertAll&lt;TOutput&gt;(Converter&lt;T, TOutput&gt;)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_System_Collections_ICollection_CopyTo_System_Array_System_Int32_">CollectionBase&lt;T&gt;.ICollection.CopyTo(Array, Int32)</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_System_Collections_ICollection_IsSynchronized">CollectionBase&lt;T&gt;.ICollection.IsSynchronized</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_System_Collections_ICollection_SyncRoot">CollectionBase&lt;T&gt;.ICollection.SyncRoot</a>
    </div>
    <div>
      <a class="xref" href="Wintellect.PowerCollections.CollectionBase-1.html#Wintellect_PowerCollections_CollectionBase_1_System_Collections_IEnumerable_GetEnumerator">CollectionBase&lt;T&gt;.IEnumerable.GetEnumerator()</a>
    </div>
    <div>
      <span class="xref">System.Object.Equals(System.Object)</span>
    </div>
    <div>
      <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
    </div>
    <div>
      <span class="xref">System.Object.GetHashCode()</span>
    </div>
    <div>
      <span class="xref">System.Object.GetType()</span>
    </div>
    <div>
      <span class="xref">System.Object.MemberwiseClone()</span>
    </div>
    <div>
      <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
    </div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="Wintellect.PowerCollections.html">Wintellect.PowerCollections</a></h6>
  <h6><strong>Assembly</strong>: CADability.dll</h6>
  <h5 id="Wintellect_PowerCollections_Bag_1_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">[Serializable]
public class Bag&lt;T&gt; : CollectionBase&lt;T&gt;, ICollection&lt;T&gt;, IEnumerable&lt;T&gt;, ICollection, IEnumerable, ICloneable</code></pre>
  </div>
  <h5 class="typeParameters">Type Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="parametername">T</span></td>
        <td></td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>The items are compared in one of two ways. If T implements IComparable&lt;T> 
then the Equals method of that interface will be used to compare items, otherwise the Equals
method from Object will be used. Alternatively, an instance of IComparer&lt;T> can be passed
to the constructor to use to compare items.</p>
<p>Bag is implemented as a hash table. Inserting, deleting, and looking up an
an element all are done in approximately constant time, regardless of the number of items in the bag.</p>
<p>When multiple equal items are stored in the bag, they are stored as a representative item and a count. 
If equal items can be distinguished, this may be noticable. For example, if a case-insensitive
comparer is used with a Bag&lt;string>, and both &quot;hello&quot;, and &quot;HELLO&quot; are added to the bag, then the
bag will appear to contain two copies of &quot;hello&quot; (the representative item).</p>
<p><see cref="!:OrderedBag&lt;T>"></see> is similar, but uses comparison instead of hashing, maintain
the items in sorted order, and stores distinct copies of items that compare equal.</p>
</div>
  <h3 id="constructors">Constructors
  </h3>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1__ctor.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.%23ctor%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L81">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1__ctor_" data-uid="Wintellect.PowerCollections.Bag`1.#ctor*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1__ctor" data-uid="Wintellect.PowerCollections.Bag`1.#ctor">Bag()</h4>
  <div class="markdown level1 summary"><p>Creates a new Bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag()</code></pre>
  </div>
  <h5 id="Wintellect_PowerCollections_Bag_1__ctor_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Items that are null are permitted.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEnumerable__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.%23ctor(System.Collections.Generic.IEnumerable%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L109">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1__ctor_" data-uid="Wintellect.PowerCollections.Bag`1.#ctor*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEnumerable__0__" data-uid="Wintellect.PowerCollections.Bag`1.#ctor(System.Collections.Generic.IEnumerable{`0})">Bag(IEnumerable&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Creates a new Bag. The bag is
initialized with all the items in the given collection.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag(IEnumerable&lt;T&gt; collection)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">collection</span></td>
        <td><p>A collection with items to be placed into the Bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEnumerable__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Items that are null are permitted.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEnumerable__0__System_Collections_Generic_IEqualityComparer__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.%23ctor(System.Collections.Generic.IEnumerable%7B%600%7D%2CSystem.Collections.Generic.IEqualityComparer%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L121">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1__ctor_" data-uid="Wintellect.PowerCollections.Bag`1.#ctor*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEnumerable__0__System_Collections_Generic_IEqualityComparer__0__" data-uid="Wintellect.PowerCollections.Bag`1.#ctor(System.Collections.Generic.IEnumerable{`0},System.Collections.Generic.IEqualityComparer{`0})">Bag(IEnumerable&lt;T&gt;, IEqualityComparer&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object
will be used to compare items in this bag. The bag is
initialized with all the items in the given collection.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag(IEnumerable&lt;T&gt; collection, IEqualityComparer&lt;T&gt; equalityComparer)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">collection</span></td>
        <td><p>A collection with items to be placed into the Bag.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEqualityComparer</span>&lt;T&gt;</td>
        <td><span class="parametername">equalityComparer</span></td>
        <td><p>An instance of IEqualityComparer&lt;T&gt; that will be used to compare items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEqualityComparer__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.%23ctor(System.Collections.Generic.IEqualityComparer%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L91">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1__ctor_" data-uid="Wintellect.PowerCollections.Bag`1.#ctor*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1__ctor_System_Collections_Generic_IEqualityComparer__0__" data-uid="Wintellect.PowerCollections.Bag`1.#ctor(System.Collections.Generic.IEqualityComparer{`0})">Bag(IEqualityComparer&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object
will be used to compare items in this bag for equality.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag(IEqualityComparer&lt;T&gt; equalityComparer)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEqualityComparer</span>&lt;T&gt;</td>
        <td><span class="parametername">equalityComparer</span></td>
        <td><p>An instance of IEqualityComparer&lt;T&gt; that will be used to compare items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
  </h3>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Comparer.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Comparer%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L218">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Comparer_" data-uid="Wintellect.PowerCollections.Bag`1.Comparer*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Comparer" data-uid="Wintellect.PowerCollections.Bag`1.Comparer">Comparer</h4>
  <div class="markdown level1 summary"><p>Returns the IEqualityComparer&lt;T&gt; used to compare items in this bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IEqualityComparer&lt;T&gt; Comparer { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEqualityComparer</span>&lt;T&gt;</td>
        <td><p>If the bag was created using a comparer, that comparer is returned. Otherwise
the default comparer for T (EqualityComparer&lt;T&gt;.Default) is returned.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Count.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Count%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L231">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Count_" data-uid="Wintellect.PowerCollections.Bag`1.Count*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Count" data-uid="Wintellect.PowerCollections.Bag`1.Count">Count</h4>
  <div class="markdown level1 summary"><p>Returns the number of items in the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed int Count { get; }</code></pre>
  </div>
  <h5 class="propertyValue">Property Value</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>The number of items in the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.Count</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_Count_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The size of the bag is returned in constant time.</p>
</div>
  <h3 id="methods">Methods
  </h3>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Add__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Add(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L344">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Add_" data-uid="Wintellect.PowerCollections.Bag`1.Add*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Add__0_" data-uid="Wintellect.PowerCollections.Bag`1.Add(`0)">Add(T)</h4>
  <div class="markdown level1 summary"><p>Adds a new item to the bag. Since bags can contain duplicate items, the item
is added even if the bag already contains an item equal to <code data-dev-comment-type="paramref" class="paramref">item</code>. In
this case, the count of items for the representative item is increased by one, but the existing
represetative item is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed void Add(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to add to the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.Add(T)</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_Add__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Adding an item takes approximately constant time, regardless of the number of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_AddMany_System_Collections_Generic_IEnumerable__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.AddMany(System.Collections.Generic.IEnumerable%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L415">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_AddMany_" data-uid="Wintellect.PowerCollections.Bag`1.AddMany*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_AddMany_System_Collections_Generic_IEnumerable__0__" data-uid="Wintellect.PowerCollections.Bag`1.AddMany(System.Collections.Generic.IEnumerable{`0})">AddMany(IEnumerable&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Adds all the items in <code data-dev-comment-type="paramref" class="paramref">collection</code> to the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void AddMany(IEnumerable&lt;T&gt; collection)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">collection</span></td>
        <td><p>A collection of items to add to the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_AddMany_System_Collections_Generic_IEnumerable__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Adding the collection takes time O(M log N), where N is the number of items in the bag, and M is the 
number of items in <code data-dev-comment-type="paramref" class="paramref">collection</code>.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_AddRepresentative__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.AddRepresentative(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L366">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_AddRepresentative_" data-uid="Wintellect.PowerCollections.Bag`1.AddRepresentative*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_AddRepresentative__0_" data-uid="Wintellect.PowerCollections.Bag`1.AddRepresentative(`0)">AddRepresentative(T)</h4>
  <div class="markdown level1 summary"><p>Adds a new item to the bag. Since bags can contain duplicate items, the item
is added even if the bag already contains an item equal to <code data-dev-comment-type="paramref" class="paramref">item</code>. In
this case (unlike Add), the new item becomes the representative item.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void AddRepresentative(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to add to the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_AddRepresentative__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Adding an item takes approximately constant time, regardless of the number of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_ChangeNumberOfCopies__0_System_Int32_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.ChangeNumberOfCopies(%600%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L387">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_ChangeNumberOfCopies_" data-uid="Wintellect.PowerCollections.Bag`1.ChangeNumberOfCopies*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_ChangeNumberOfCopies__0_System_Int32_" data-uid="Wintellect.PowerCollections.Bag`1.ChangeNumberOfCopies(`0,System.Int32)">ChangeNumberOfCopies(T, Int32)</h4>
  <div class="markdown level1 summary"><p>Changes the number of copies of an existing item in the bag, or adds the indicated number
of copies of the item to the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void ChangeNumberOfCopies(T item, int numCopies)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to change the number of copies of. This may or may not already be present in the bag.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><span class="parametername">numCopies</span></td>
        <td><p>The new number of copies of the item.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_ChangeNumberOfCopies__0_System_Int32__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Changing the number of copies takes approximately constant time, regardless of the number of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Clear.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Clear%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L526">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Clear_" data-uid="Wintellect.PowerCollections.Bag`1.Clear*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Clear" data-uid="Wintellect.PowerCollections.Bag`1.Clear">Clear()</h4>
  <div class="markdown level1 summary"><p>Removes all items from the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed void Clear()</code></pre>
  </div>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.Clear()</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_Clear_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Clearing the bag takes a constant amount of time, regardless of the number of items in it.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Clone.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Clone%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L166">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Clone_" data-uid="Wintellect.PowerCollections.Bag`1.Clone*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Clone" data-uid="Wintellect.PowerCollections.Bag`1.Clone">Clone()</h4>
  <div class="markdown level1 summary"><p>Makes a shallow clone of this bag; i.e., if items of the
bag are reference types, then they are not cloned. If T is a value type,
then each element is copied as if by simple assignment.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; Clone()</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The cloned bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_Clone_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Cloning the bag takes time O(N), where N is the number of unquie items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_CloneContents.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.CloneContents%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L182">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_CloneContents_" data-uid="Wintellect.PowerCollections.Bag`1.CloneContents*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_CloneContents" data-uid="Wintellect.PowerCollections.Bag`1.CloneContents">CloneContents()</h4>
  <div class="markdown level1 summary"><p>Makes a deep clone of this bag. A new bag is created with a clone of
each element of this bag, by calling ICloneable.Clone on each element. If T is
a value type, then each element is copied as if by simple assignment.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; CloneContents()</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The cloned bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_CloneContents_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>If T is a reference type, it must implement
    ICloneable. Otherwise, an InvalidOperationException is thrown.</p>
<p>Cloning the bag takes time O(N log N), where N is the number of items in the bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>T is a reference type that does not implement ICloneable.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Contains__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Contains(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L309">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Contains_" data-uid="Wintellect.PowerCollections.Bag`1.Contains*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Contains__0_" data-uid="Wintellect.PowerCollections.Bag`1.Contains(`0)">Contains(T)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag contains an item equal to <code data-dev-comment-type="paramref" class="paramref">item</code>. The bag
is not changed.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed bool Contains(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to search for.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if the bag contains <code data-dev-comment-type="paramref" class="paramref">item</code>. False if the bag does not contain <code data-dev-comment-type="paramref" class="paramref">item</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.Contains(T)</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_Contains__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Searching the bag for an item takes time O(log N), where N is the number of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Difference_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Difference(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L973">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Difference_" data-uid="Wintellect.PowerCollections.Bag`1.Difference*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Difference_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.Difference(Wintellect.PowerCollections.Bag{`0})">Difference(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the difference of this bag with another bag. The difference of these two bags
is all items that appear in this bag, but not in <code data-dev-comment-type="paramref" class="paramref">otherBag</code>. If an item appears X times in this bag,
and Y times in the other bag, the difference contains the item X - Y times (zero times if Y &gt;= X).  A new bag is
created with the difference of the bags and is returned. This bag and the other bag
are unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; Difference(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to difference with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The difference of the two bags.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_Difference_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The difference of two bags is computed in time O(M + N), where M and N are the size
of the two bags.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_DifferenceWith_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.DifferenceWith(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L933">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_DifferenceWith_" data-uid="Wintellect.PowerCollections.Bag`1.DifferenceWith*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_DifferenceWith_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.DifferenceWith(Wintellect.PowerCollections.Bag{`0})">DifferenceWith(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the difference of this bag with another bag. The difference of these two bags
is all items that appear in this bag, but not in <code data-dev-comment-type="paramref" class="paramref">otherBag</code>. If an item appears X times in this bag,
and Y times in the other bag, the difference contains the item X - Y times (zero times if Y &gt;= X). This bag receives
the difference of the two bags; the other bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void DifferenceWith(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to difference with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_DifferenceWith_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The difference of two bags is computed in time O(M), where M is the size of the 
other bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_DistinctItems.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.DistinctItems%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L322">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_DistinctItems_" data-uid="Wintellect.PowerCollections.Bag`1.DistinctItems*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_DistinctItems" data-uid="Wintellect.PowerCollections.Bag`1.DistinctItems">DistinctItems()</h4>
  <div class="markdown level1 summary"><p>Enumerates all the items in the bag, but enumerates equal items
just once, even if they occur multiple times in the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public IEnumerable&lt;T&gt; DistinctItems()</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><p>An IEnumerable&lt;T&gt; that enumerates the unique items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_DistinctItems_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>If the bag is changed while items are being enumerated, the
enumeration will terminate with an InvalidOperationException.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_GetEnumerator.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.GetEnumerator%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L293">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_GetEnumerator_" data-uid="Wintellect.PowerCollections.Bag`1.GetEnumerator*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_GetEnumerator" data-uid="Wintellect.PowerCollections.Bag`1.GetEnumerator">GetEnumerator()</h4>
  <div class="markdown level1 summary"><p>Returns an enumerator that enumerates all the items in the bag.
If an item is present multiple times in the bag, the representative item is yielded by the
enumerator multiple times. The order of enumeration is haphazard and may change.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed IEnumerator&lt;T&gt; GetEnumerator()</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerator</span>&lt;T&gt;</td>
        <td><p>An enumerator for enumerating all the items in the Bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.GetEnumerator()</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_GetEnumerator_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Typically, this method is not called directly. Instead the &quot;foreach&quot; statement is used
to enumerate the items, which uses this method implicitly.</p>
<p>If an item is added to or deleted from the bag while it is being enumerated, then 
the enumeration will end with an InvalidOperationException.</p>
<p>Enumeration all the items in the bag takes time O(N), where N is the number
of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_GetRepresentativeItem__0__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.GetRepresentativeItem(%600%2C%600%40)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L264">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_GetRepresentativeItem_" data-uid="Wintellect.PowerCollections.Bag`1.GetRepresentativeItem*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_GetRepresentativeItem__0__0__" data-uid="Wintellect.PowerCollections.Bag`1.GetRepresentativeItem(`0,`0@)">GetRepresentativeItem(T, out T)</h4>
  <div class="markdown level1 summary"><p>Returns the representative item stored in the bag that is equal to
the provided item. Also returns the number of copies of the item in the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int GetRepresentativeItem(T item, out T representative)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>Item to find in the bag.</p>
</td>
      </tr>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">representative</span></td>
        <td><p>If one or more items equal to <code data-dev-comment-type="paramref" class="paramref">item</code> are present in the
bag, returns the representative item. If no items equal to <code data-dev-comment-type="paramref" class="paramref">item</code> are stored in the bag,
returns <code data-dev-comment-type="paramref" class="paramref">item</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>The number of items equal to <code data-dev-comment-type="paramref" class="paramref">item</code> stored in the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Intersection_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Intersection(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L890">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Intersection_" data-uid="Wintellect.PowerCollections.Bag`1.Intersection*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Intersection_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.Intersection(Wintellect.PowerCollections.Bag{`0})">Intersection(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the intersection of this bag with another bag. The intersection of two bags
is all items that appear in both of the bags. If an item appears X times in one bag,
and Y times in the other bag, the intersection contains the item Minimum(X,Y) times. A new bag is
created with the intersection of the bags and is returned. This bag and the other bag
are unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; Intersection(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to intersection with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The intersection of the two bags.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_Intersection_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>When equal items appear in both bags, the intersection will include an arbitrary choice of one of the
two equal items.</p>
<p>The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IntersectionWith_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IntersectionWith(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L836">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IntersectionWith_" data-uid="Wintellect.PowerCollections.Bag`1.IntersectionWith*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IntersectionWith_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IntersectionWith(Wintellect.PowerCollections.Bag{`0})">IntersectionWith(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the intersection of this bag with another bag. The intersection of two bags
is all items that appear in both of the bags. If an item appears X times in one bag,
and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives
the intersection of the two bags, the other bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void IntersectionWith(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to intersection with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IntersectionWith_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>When equal items appear in both bags, the intersection will include an arbitrary choice of one of the
two equal items.</p>
<p>The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsDisjointFrom_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsDisjointFrom(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L667">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsDisjointFrom_" data-uid="Wintellect.PowerCollections.Bag`1.IsDisjointFrom*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsDisjointFrom_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsDisjointFrom(Wintellect.PowerCollections.Bag{`0})">IsDisjointFrom(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is disjoint from another bag. Two bags are disjoint
if no item from one set is equal to any item in the other bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsDisjointFrom(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to check disjointness with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if the two bags are disjoint, false otherwise.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IsDisjointFrom_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The answer is computed in time O(N), where N is the size of the smaller set.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsEqualTo_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsEqualTo(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L564">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsEqualTo_" data-uid="Wintellect.PowerCollections.Bag`1.IsEqualTo*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsEqualTo_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsEqualTo(Wintellect.PowerCollections.Bag{`0})">IsEqualTo(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is equal to another bag. This bag is equal to
<code data-dev-comment-type="paramref" class="paramref">otherBag</code> if they contain the same number of
of copies of equal elements.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsEqualTo(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to compare to</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if this bag is equal to <code data-dev-comment-type="paramref" class="paramref">otherBag</code>, false otherwise.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IsEqualTo_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>IsSupersetOf is computed in time O(N), where N is the number of unique items in
this bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsProperSubsetOf_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsProperSubsetOf(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L652">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsProperSubsetOf_" data-uid="Wintellect.PowerCollections.Bag`1.IsProperSubsetOf*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsProperSubsetOf_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsProperSubsetOf(Wintellect.PowerCollections.Bag{`0})">IsProperSubsetOf(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is a proper subset of another bag. Neither bag is modified.
This bag is a subset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code> if every element in this bag
is also in <code data-dev-comment-type="paramref" class="paramref">otherBag</code>, at least the same number of
times. Additional, this bag must have strictly fewer items than <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsProperSubsetOf(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to compare to.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if this is a proper subset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IsProperSubsetOf_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>IsProperSubsetOf is computed in time O(N), where N is the number of unique items in this bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsProperSupersetOf_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsProperSupersetOf(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L621">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsProperSupersetOf_" data-uid="Wintellect.PowerCollections.Bag`1.IsProperSupersetOf*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsProperSupersetOf_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsProperSupersetOf(Wintellect.PowerCollections.Bag{`0})">IsProperSupersetOf(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is a proper superset of another bag. Neither bag is modified.
This bag is a proper superset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code> if every element in
<code data-dev-comment-type="paramref" class="paramref">otherBag</code> is also in this bag, at least the same number of
times. Additional, this bag must have strictly more items than <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsProperSupersetOf(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Set to compare to.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if this is a proper superset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IsProperSupersetOf_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>IsProperSupersetOf is computed in time O(M), where M is the number of unique items in
<code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsSubsetOf_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsSubsetOf(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L637">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsSubsetOf_" data-uid="Wintellect.PowerCollections.Bag`1.IsSubsetOf*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsSubsetOf_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsSubsetOf(Wintellect.PowerCollections.Bag{`0})">IsSubsetOf(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is a subset of another ba11 items in this bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsSubsetOf(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to compare to.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if this is a subset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_IsSupersetOf_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.IsSupersetOf(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L593">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_IsSupersetOf_" data-uid="Wintellect.PowerCollections.Bag`1.IsSupersetOf*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_IsSupersetOf_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.IsSupersetOf(Wintellect.PowerCollections.Bag{`0})">IsSupersetOf(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Determines if this bag is a superset of another bag. Neither bag is modified.
This bag is a superset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code> if every element in
<code data-dev-comment-type="paramref" class="paramref">otherBag</code> is also in this bag, at least the same number of
times.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public bool IsSupersetOf(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to compare to.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if this is a superset of <code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_IsSupersetOf_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>IsSupersetOf is computed in time O(M), where M is the number of unique items in
<code data-dev-comment-type="paramref" class="paramref">otherBag</code>.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_NumberOfCopies__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.NumberOfCopies(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L246">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_NumberOfCopies_" data-uid="Wintellect.PowerCollections.Bag`1.NumberOfCopies*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_NumberOfCopies__0_" data-uid="Wintellect.PowerCollections.Bag`1.NumberOfCopies(`0)">NumberOfCopies(T)</h4>
  <div class="markdown level1 summary"><p>Returns the number of copies of <code data-dev-comment-type="paramref" class="paramref">item</code> in the bag.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int NumberOfCopies(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to search for in the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>The number of items in the bag that compare equal to <code data-dev-comment-type="paramref" class="paramref">item</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_NumberOfCopies__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>NumberOfCopies() takes approximately constant time, no matter how many items
are stored in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Remove__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Remove(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L444">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Remove_" data-uid="Wintellect.PowerCollections.Bag`1.Remove*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Remove__0_" data-uid="Wintellect.PowerCollections.Bag`1.Remove(`0)">Remove(T)</h4>
  <div class="markdown level1 summary"><p>Searches the bag for one item equal to <code data-dev-comment-type="paramref" class="paramref">item</code>, and if found,
removes it from the bag. If not found, the bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public override sealed bool Remove(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to remove.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Boolean</span></td>
        <td><p>True if <code data-dev-comment-type="paramref" class="paramref">item</code> was found and removed. False if <code data-dev-comment-type="paramref" class="paramref">item</code> was not in the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="overrides">Overrides</h5>
  <div><span class="xref">Wintellect.PowerCollections.CollectionBase&lt;T&gt;.Remove(T)</span></div>
  <h5 id="Wintellect_PowerCollections_Bag_1_Remove__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Equality between items is determined by the comparison instance or delegate used
to create the bag.</p>
<p>Removing an item from the bag takes approximated constant time,
regardless of the number of items in the bag.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_RemoveAllCopies__0_.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.RemoveAllCopies(%600)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L474">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_RemoveAllCopies_" data-uid="Wintellect.PowerCollections.Bag`1.RemoveAllCopies*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_RemoveAllCopies__0_" data-uid="Wintellect.PowerCollections.Bag`1.RemoveAllCopies(`0)">RemoveAllCopies(T)</h4>
  <div class="markdown level1 summary"><p>Searches the bag for all items equal to <code data-dev-comment-type="paramref" class="paramref">item</code>, and
removes all of them from the bag. If not found, the bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int RemoveAllCopies(T item)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">T</span></td>
        <td><span class="parametername">item</span></td>
        <td><p>The item to remove.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>The number of copies of <code data-dev-comment-type="paramref" class="paramref">item</code> that were found and removed.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_RemoveAllCopies__0__remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Equality between items is determined by the comparer instance used
to create the bag.</p>
<p>RemoveAllCopies() takes time O(M log N), where N is the total number of items in the bag, and M is
the number of items equal to <code data-dev-comment-type="paramref" class="paramref">item</code>.</p>
</div>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_RemoveMany_System_Collections_Generic_IEnumerable__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.RemoveMany(System.Collections.Generic.IEnumerable%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L498">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_RemoveMany_" data-uid="Wintellect.PowerCollections.Bag`1.RemoveMany*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_RemoveMany_System_Collections_Generic_IEnumerable__0__" data-uid="Wintellect.PowerCollections.Bag`1.RemoveMany(System.Collections.Generic.IEnumerable{`0})">RemoveMany(IEnumerable&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Removes all the items in <code data-dev-comment-type="paramref" class="paramref">collection</code> from the bag. Items that
are not present in the bag are ignored.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public int RemoveMany(IEnumerable&lt;T&gt; collection)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;T&gt;</td>
        <td><span class="parametername">collection</span></td>
        <td><p>A collection of items to remove from the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Int32</span></td>
        <td><p>The number of items removed from the bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_RemoveMany_System_Collections_Generic_IEnumerable__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Equality between items is determined by the comparer instance used
to create the bag.</p>
<p>Removing the collection takes time O(M), where M is the 
number of items in <code data-dev-comment-type="paramref" class="paramref">collection</code>.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.ArgumentNullException</span></td>
        <td><p><code data-dev-comment-type="paramref" class="paramref">collection</code> is null.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Sum_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Sum(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L804">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Sum_" data-uid="Wintellect.PowerCollections.Bag`1.Sum*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Sum_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.Sum(Wintellect.PowerCollections.Bag{`0})">Sum(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the sum of this bag with another bag. he sum of two bags
is all items from both of the bags.  If an item appears X times in one bag,
and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is
created with the sum of the bags and is returned. This bag and the other bag
are unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; Sum(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to sum with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The sum of the two bags.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_Sum_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The sum of two bags is computed in time O(M + N log M), where M is the size of the 
larger bag, and N is the size of the smaller bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_SumWith_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.SumWith(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L766">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_SumWith_" data-uid="Wintellect.PowerCollections.Bag`1.SumWith*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_SumWith_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.SumWith(Wintellect.PowerCollections.Bag{`0})">SumWith(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the sum of this bag with another bag. The sum of two bags
is all items from both of the bags. If an item appears X times in one bag,
and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives
the sum of the two bags, the other bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void SumWith(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to sum with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_SumWith_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The sum of two bags is computed in time O(M), where M is the size of the 
other bag..</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_SymmetricDifference_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.SymmetricDifference(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L1035">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_SymmetricDifference_" data-uid="Wintellect.PowerCollections.Bag`1.SymmetricDifference*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_SymmetricDifference_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.SymmetricDifference(Wintellect.PowerCollections.Bag{`0})">SymmetricDifference(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags
is all items that appear in either of the bags, but not both. If an item appears X times in one bag,
and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. A new bag is
created with the symmetric difference of the bags and is returned. This bag and the other bag
are unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; SymmetricDifference(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to symmetric difference with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The symmetric difference of the two bags.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_SymmetricDifference_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The symmetric difference of two bags is computed in time O(M + N), where M is the size of the 
larger bag, and N is the size of the smaller bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_SymmetricDifferenceWith_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.SymmetricDifferenceWith(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L996">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_SymmetricDifferenceWith_" data-uid="Wintellect.PowerCollections.Bag`1.SymmetricDifferenceWith*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_SymmetricDifferenceWith_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.SymmetricDifferenceWith(Wintellect.PowerCollections.Bag{`0})">SymmetricDifferenceWith(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags
is all items that appear in either of the bags, but not both. If an item appears X times in one bag,
and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. This bag receives
the symmetric difference of the two bags; the other bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void SymmetricDifferenceWith(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to symmetric difference with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_SymmetricDifferenceWith_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The symmetric difference of two bags is computed in time O(M + N), where M is the size of the 
larger bag, and N is the size of the smaller bag.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_Union_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.Union(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L735">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_Union_" data-uid="Wintellect.PowerCollections.Bag`1.Union*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_Union_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.Union(Wintellect.PowerCollections.Bag{`0})">Union(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the union of this bag with another bag. The union of two bags
is all items from both of the bags.  If an item appears X times in one bag,
and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is
created with the union of the bags and is returned. This bag and the other bag
are unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public Bag&lt;T&gt; Union(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to union with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><p>The union of the two bags.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_Union_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The union of two bags is computed in time O(M+N), where M and N are the size of the two bags.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_UnionWith_Wintellect_PowerCollections_Bag__0__.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.UnionWith(Wintellect.PowerCollections.Bag%7B%600%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L701">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_UnionWith_" data-uid="Wintellect.PowerCollections.Bag`1.UnionWith*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_UnionWith_Wintellect_PowerCollections_Bag__0__" data-uid="Wintellect.PowerCollections.Bag`1.UnionWith(Wintellect.PowerCollections.Bag{`0})">UnionWith(Bag&lt;T&gt;)</h4>
  <div class="markdown level1 summary"><p>Computes the union of this bag with another bag. The union of two bags
is all items from both of the bags. If an item appears X times in one bag,
and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives
the union of the two bags, the other bag is unchanged.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public void UnionWith(Bag&lt;T&gt; otherBag)</code></pre>
  </div>
  <h5 class="parameters">Parameters</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><a class="xref" href="Wintellect.PowerCollections.Bag-1.html">Bag</a>&lt;T&gt;</td>
        <td><span class="parametername">otherBag</span></td>
        <td><p>Bag to union with.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_UnionWith_Wintellect_PowerCollections_Bag__0___remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>The union of two bags is computed in time O(M+N), where M and N are the size of the 
two bags.</p>
</div>
  <h5 class="exceptions">Exceptions</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Condition</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.InvalidOperationException</span></td>
        <td><p>This bag and <code data-dev-comment-type="paramref" class="paramref">otherBag</code> don't use the same method for comparing items.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="eii">Explicit Interface Implementations
  </h3>
  <span class="small pull-right mobile-hide">
    <span class="divider">|</span>
    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1_System_ICloneable_Clone.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601.System%23ICloneable%23Clone%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
  </span>
  <span class="small pull-right mobile-hide">
    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L154">View Source</a>
  </span>
  <a id="Wintellect_PowerCollections_Bag_1_System_ICloneable_Clone_" data-uid="Wintellect.PowerCollections.Bag`1.System#ICloneable#Clone*"></a>
  <h4 id="Wintellect_PowerCollections_Bag_1_System_ICloneable_Clone" data-uid="Wintellect.PowerCollections.Bag`1.System#ICloneable#Clone">ICloneable.Clone()</h4>
  <div class="markdown level1 summary"><p>Makes a shallow clone of this bag; i.e., if items of the
bag are reference types, then they are not cloned. If T is a value type,
then each element is copied as if by simple assignment.</p>
</div>
  <div class="markdown level1 conceptual"></div>
  <h5 class="decalaration">Declaration</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">object ICloneable.Clone()</code></pre>
  </div>
  <h5 class="returns">Returns</h5>
  <table class="table table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><span class="xref">System.Object</span></td>
        <td><p>The cloned bag.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h5 id="Wintellect_PowerCollections_Bag_1_System_ICloneable_Clone_remarks">Remarks</h5>
  <div class="markdown level1 remarks"><p>Cloning the bag takes time O(N), where N is the number of items in the bag.</p>
</div>
  <h3 id="implements">Implements</h3>
  <div>
      <span class="xref">System.Collections.Generic.ICollection&lt;T&gt;</span>
  </div>
  <div>
      <span class="xref">System.Collections.Generic.IEnumerable&lt;T&gt;</span>
  </div>
  <div>
      <span class="xref">System.Collections.ICollection</span>
  </div>
  <div>
      <span class="xref">System.Collections.IEnumerable</span>
  </div>
  <div>
      <span class="xref">System.ICloneable</span>
  </div>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                  <li>
                    <a href="https://github.com/SOFAgh/CADability/new/master/apiSpec/new?filename=Wintellect_PowerCollections_Bag_1.md&amp;value=---%0Auid%3A%20Wintellect.PowerCollections.Bag%601%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
                  </li>
                  <li>
                    <a href="https://github.com/SOFAgh/CADability/blob/master/CADability/Bag.cs/#L34" class="contribution-link">View Source</a>
                  </li>
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
                <h5>In This Article</h5>
                <div></div>
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="../styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="../styles/docfx.js"></script>
    <script type="text/javascript" src="../styles/main.js"></script>
  </body>
</html>
